package thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExecutorFactory {
    public static ExecutorService create(char type) {
        ExecutorService service = null;
        switch (type) {
            case 'c':
                service = Executors.newCachedThreadPool();
                break;
            case 'f':
                service = Executors.newFixedThreadPool(3);
                break;
            case 's':
                service = Executors.newSingleThreadExecutor();
                break;
        }
        return service;
    }
}
